package cn.tedu.tmall.basic.startup;

import cn.tedu.tmall.basic.service.IDistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class CustomRunner implements ApplicationRunner {

    @Autowired
    private IDistrictService districtService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("通过缓存预热的方法，将MySQL中的省市区数据加载到Redis缓存中……");
        // districtService.rebuildCache();
        districtService.rebuildCacheList();
    }


}
